package com.test.demo;

import org.junit.Test;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;

/**
 * ${DESCRIPTION}
 *
 * @author muxiaoyu
 * @create 2017/05/04 17:07
 **/
public class Main {
    /*public static void main(String[] args) {
        Dog dog222 = null;
        //dog222=new Dog();
        System.out.println(dog222);
        Dog dog = new Dog();
        dog.setName("旺财");
        *//*Person person = new Person();
        person.setName("张三");
        person.setDog(dog);*//*
        System.out.println("before changeDog：" + dog);
        changeDog(dog);
        System.out.println("after changeDog：" + dog);
        *//*Person person1 = new Person();
        person1.setName("lisi");
        System.out.println(person1);*//*
        System.gc();
    }

    public static void changeDog(Dog d) {
        d = new Dog();
        d.setName("狗蛋");
        System.out.println(d);
    }*/

    @Test
    public void test222() {
        Dog dog = new Dog();
        Dog dog2 = new Dog();
        System.out.println(dog.hashCode() == dog2.hashCode());
    }

    @Test
    public void test000() {
        Animal animal = new Animal();
        animal.setId(3338);
        animal.setName("animal3338");
        animal.Say();
    }

    @Test
    public void test0020() throws IllegalAccessException, InstantiationException {
       /* Dog animal = new Dog();
        animal.setId(3338);
        animal.setName("animal3338");
        animal.Say();*/
    }

    @Test
    public void test98() {
        System.out.println(Xiaoyu_Child.number);
    }

    //原型模式测试
    @Test
    public void testClone() {
        Phone p1 = new Phone("iPhone7S Plus", "0001");
        Phone p2 = null;
        try {
            p2 = p1.clone();
            p2.setId("998");
            p2.setName("Android 8.0 HUAWEI HORNOR");

        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        System.out.println("p1:" + p1);
        System.out.println("p2:" + p2);

    }

    @Test
    public void testGeneric() {
        List<Dog> list = new ArrayList<Dog>();
        Field[] declaredFields = list.getClass().getDeclaredFields();
        for (Field declaredField : declaredFields) {
            System.out.println(declaredField.getName());
        }
    }

    @Test
    public void printGeneric() {
        Info<String> stringInfo = new InfoImpl();
        System.out.println(123);
    }
}
